// JavaScript Document
function limpiarForm(form){
	formulario = document.forms[form];
	elementos = formulario.elements;
	for(a=0; a<elementos.length; a++){
		elementos[a].value="";
	}

}	

function crearInput(pnombre,pvalue,preadOnly,pclass,ptabindex,palt){  
    elemText = document.createElement('input'); 
  	elemText.type = 'text'; 
 	elemText.name = pnombre; 
 	elemText.id = pnombre; 
	elemText.value = pvalue;
	elemText.readOnly = preadOnly;
	elemText.className  = pclass;
	elemText.tabIndex = ptabindex;
	elemText.alt = palt;
	return elemText;
}

function  crearLabel(destino,descripcion){
	labell = document.createElement('label');
	labell.htmlFor = destino;
	labell.innerHTML = descripcion;
	return labell;
}

//visibility:hidden;background-color:white;layer-background-color:white;
function crearDiv(nombreCapa,visibility,background,layerBack){
	div = document.createElement('div');
	div.id = nombreCapa;
	div.style.position = "absolute";
	div.style.visibility = visibility;
	div.style.backgroundColor = background;
	div.style.layerbackgroundcolor = layerBack;
	return div;
}

 function clonarSelect(SelectAClonar,name){
	  elemSelect = document.createElement('select'); 
	  elemSelect.name = name; 
	  //obj.appendChild(elemR); 
	  
	   ///////HAgo una copia del select de rol 
	  var objRol = SelectAClonar; // tengo una referencia a integrante
	  for(i=0;i<objRol.length;i++){
		// alert("esta opcion tien "+objRol.options[i].value);
		 elemO = document.createElement('option'); 
		 elemO.value = objRol.options[i].value;
		 elemO.innerHTML = objRol.options[i].text; 
		 elemSelect.appendChild(elemO); 
	
	 }
  return elemSelect;
 }

 function crearLink(objCal,elemIni,num){
	imagen =crearImagen('../../img/calendar.gif');
	
	itemlink = document.createElement('a');
	itemlink.setAttribute('href', '#');
	//itemlink.appendChild(document.createTextNode('almanaque'));
	itemlink.name='anchor'+num;
	itemlink.id='anchor'+num;
	itemlink.appendChild(imagen);
	itemlink.onclick = function(){cargarAlmanaque(objCal,elemIni,num);};
	return itemlink;
	
}

function crearImagen(ubicacion){
	img = document.createElement("IMG");
     img.src = ubicacion;
	 return img;
	 
	
	}
function crearInputCalendario(nombreInput,value,fechaDesde){
    elemIni = crearInput(nombreInput,value,"yes","DatePicker","1",fechaDesde);
	return elemIni;

}